{% extends 'base.html' %}
	
{# Side bar menu #}
{% block sidebar %}
	<div class="sidebar">
		<h3>Timeline</h3>
		<ul>
        	<li><a href="/timelines/new">Nova Timeline</a></li>
			<li><a href="/timelines">Todas as Timelines</a></li>
      	</ul>
	</div>
	<div class="sidebar">
		<h3>Eventos</h3>
		<ul>
        	<li><a href="/user/events/approved">Meus Eventos Aprovados</a></li>
			<li><a href="/user/events/nonapproved">Meus Eventos em Votação</a></li>
      	</ul>
	</div>

{% endblock %}

{% block content %}		
	<div class="content">
		<script>
			$("#events_menu").addClass("selected");
		</script>  

		<h1>Timelines - Eventos</h1>
		
		{# This selector is used to filter categories #}
		<div class="selector">
			<form action="" method="get">
				<select name="timeline_category" id="timeline_category">
					<option id=0 name="all" value="0">Todas as categorias</option>
					{% for c in category %}
						
						{% ifequal selected_category c.id %}
							<option name={{c.id}} value={{c.id}} id={{c.id}} selected="selected">{{ c.name }}</option>
						{% else %}
							<option name={{c.id}} value={{c.id}} id={{c.id}}>{{ c.name }}</option>
						{% endifequal %}
						
					{% endfor %}
				</select>
				<input type="submit" value="Ok" class="small_button" />
			</form>
		</div>
		
		<div class="p25">
	
			{% if not events_timelines %}
				{% ifequal selected_category 0 %}
					<ul>
						<li><h4>Não há timelines no sistema.</h4></li>
					</ul>
				{% else %}
					<ul>
						<li><h4>Não há timelines nesta categoria.</h4></li>
					</ul>
				{% endifequal %}
			{% endif %}
	
			{% ifequal action "list" %}
				{% for g in groups %}
					<div class="group">
						<div class="group_title">{{g.timeline}}</div>
						{% for e in g.events %}
							<li><div class="group_item"  id={{ e.id }}><a href="/timelines/{{ g.timeline.id }}">{{e}}</a></div></li>
						{% endfor %}
					</div>
				{% endfor %}
			{% endifequal %}
			
		</div>
	</div>
{% endblock %}
